<layout name='Layout/layout_page' />
<script type="text/javascript">
$(function(){
	$("#flash").click(function(){
		if ($("#picname").val()=='' && $("#exp").is(':checked')==false) {
			alert('请先上传缩略图后才能设置幻灯属性！');
			$(this).attr("checked",false);
		}
	})	
})
</script>
	
	<ol class="breadcrumb">
		<li><a href="<{:U('Article/index')}>">文章管理</a></li>
      	<li class="active">编辑</li>
    </ol>

	<form id="ajaxForm" action="<{:U('Article/update')}>" method="post" class="form-horizontal form-validata">
		<div class="form-group">
			<label class="col-md-1 control-label" for="title">文章标题：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="title"
				id="title"
				data-rule-required="true"
				value="<{$list['title']}>"
				/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="title">短标题</label>
			<div class="col-md-3">
				<input type="text"
                class="form-control"
				name="short"
				id="short"
				value="<{$list['short']}>" 
				/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="cid">分类：</label>
			<div class="col-md-11">
				<select name="cid" id="cid" class="form-control" data-rule-required="true">
		    	<option value="">==请选择==</option>
		        <volist name="clist" id="vo">
		        <option value="<{$vo['id']}>,<{$vo['path']}>"><php>
		            for($i=0; $i<$vo['count']*2; $i++){
		               echo '&nbsp;&nbsp;';            
		            }
		        </php><{$vo['name']}></option>
		        </volist>
		        </select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="keyword">站外链接：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="url"
				id="url"
				value="<{$list['url']}>"
				class="span5"
				data-rule-url="true"
				/>
				<p>使用站外链接，点击该文章后会直接跳转到外部链接地址</p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="keyword">腾讯视频ID</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="video"
				id="video"
				value="<{$list['video']}>"
				/>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="picname">缩略图：</label>
			<div class="col-md-11">
				<img class="thumbPic" id="picname_src" src="<{$list['pic']}>" />
				<input type="hidden" name="picname" id="picname" value="<{$list['picname']}>" />
				<p class="pic-btn"><input type="button" value="上传" class="btn btn-default btn-sm" onclick="uploadImage( '<{:U('Admin/Upload/singleImage')}>' , 'picname')"/> <input type="button" value="删除图片" class="btn btn-default btn-sm" onclick="delImage('picname')"/></p>
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-11 col-md-offset-1">
				<label class="checkbox-inline">
					<input type="checkbox" name="exp" id="exp" value="1"> 以正文第一张为缩略图
				</label>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="keyword">属性</label>
			<div class="col-md-11">
				<label class="checkbox-inline">
					<input type="checkbox" name="flash" id="flash" value="1" <php>if($list['flash']==='1')echo checked;</php>> 幻灯
				</label>
				<label class="checkbox-inline">
				  	<input type="checkbox" name="comm" value="1" <php>if($list['comm']==='1')echo checked;</php>> 推荐
				</label>
				<label class="checkbox-inline">
				  	<input type="checkbox" name="top" value="1" <php>if($list['top']==='1')echo checked;</php>> 置顶
				</label>
				<label class="checkbox-inline">
				  	<input type="checkbox" name="bold" value="1" <php>if($list['bold']==='1')echo checked;</php>> 加粗
				</label>
				<label class="checkbox-inline">
				  	<input type="checkbox" name="red" value="1" <php>if($list['red']==='1')echo checked;</php>> 套红
				</label>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="from">来源</label>
			<div class="col-md-2">
				<input type="text"
                class="form-control"
				name="from"
				id="from"
				value="<{$list['from']}>" 
				/>
			</div>
			<label class="col-md-1 control-label" for="from">作者</label>
			<div class="col-md-2">
				<input type="text"
                class="form-control"
				name="author"
				id="author"
				value="<{$list['author']}>" 
				/>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="keyword">关键词：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="keyword"
				id="keyword"
				class="span5"
				value="<{$list['keyword']}>"
				/>
				<p>多个关键词用“,”号隔开</p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="sort">排序：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				class="input-small"
				name="sort"
				id="sort"
				value="<{$list['sort']}>"
				data-rule-required="true"
				data-rule-number="true"
				/>
				<p>数字越小越靠前</p>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="keywords">描述：</label>
			<div class="col-md-11">
				<textarea name="intr" class="form-control areatext"><{$list['intr']}></textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="keywords">正文：</label>
			<div class="col-md-11">
				<textarea name="content" id="container"><{$list['content']}></textarea>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/my.config.js"></script>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/ueditor.all.js"></script>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/lang/zh-cn/zh-cn.js"></script>
				<script type="text/javascript">
				var defPath = "<{:C('UPLOAD_PATH')}>";
				window.UEDITOR_CONFIG.imagePath= defPath;  //插入编辑器中图片路径修正
				window.UEDITOR_CONFIG.filePath= defPath; //插入编辑器中文件路径修正
				window.UEDITOR_CONFIG.scrawlPath= defPath; //涂鸦默认路径
				var editor = UE.getEditor('container');
				</script>
			</div>
		</div>
			
		<div class="form-group">
			<div class="col-md-11 col-sm-offset-1">
				<button type="submit" class="btn btn-info">编辑</button>
			</div>
		</div>
		<input type="hidden" name="id" value="<{$list['id']}>" />
	</form>
	
<script type="text/javascript">
$("#cid").val("<{$list['cid']}>,<{$list['path']}>");
</script>



<input type="hidden" id="menu_action" value="article" />
